﻿using System;
using System;
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Text;
using netDxf;
using netDxf.Blocks;
using netDxf.Collections;
using netDxf.Entities;
using netDxf.Header;
using netDxf.Objects;
using netDxf.Tables;
using netDxf.Units;
using Attribute = netDxf.Entities.Attribute;
using Image = netDxf.Entities.Image;
using Point = netDxf.Entities.Point;
using Trace = netDxf.Entities.Trace;
using System.Threading;

namespace TestDxfDocument
{

    class Indexableinsertsturningtoolforinternalthreading
    {
        public static void _Indexableinsertsturningtoolforinternalthreading(Dictionary<string, Object> data)//细柄丝锥
        {
            DxfDocument dxf = new DxfDocument();
            //图层
            Layer contour = new Layer("contour") { Color = AciColor.Cyan };    //轮廓层
            Layer dimensioning = new Layer("dimensioning");    //尺寸层
            Layer refin = new Layer("refin") { Color = AciColor.Red };    //基准线/内轮廓
            refin.Linetype = Linetype.Dashed;
            Layer centre = new Layer("centre") { Color = AciColor.Yellow };    //中心线
            Layer textlayer = new Layer("textlayer") { Color = AciColor.Blue };    //文本层
            Layer hatching = new Layer("hatching") { Color = AciColor.Blue };    //填充层
            centre.Linetype = Linetype.DashDot;
            Layer additionalline = new Layer("additionalline") { Color = AciColor.Cyan };    //附加线
            Layer cutting = new Layer("cutting") { Color = AciColor.Red };    //切削层
            Layer nocutting = new Layer("nocutting");    //非切削层
            Layer skcontour = new Layer("skcontour") { Color = AciColor.Cyan };    //sk轮廓层
            Layer skdimensioning = new Layer("skdimensioning");    //sk尺寸线层
            Layer skrefin = new Layer("skrefin") { Color = AciColor.Red };    //sk基准线/内轮廓
            Layer sktext = new Layer("sktext") { Color = AciColor.Blue };  //sk文本
            Layer skhatching = new Layer("skhatching") { Color = AciColor.Blue };    //sk填充
            Layer skadditionlline = new Layer("skadditionlline") { Color = AciColor.Cyan };    //sk附加线
            Layer skviewcontour = new Layer("skviewcontour") { Color = AciColor.Cyan };    //skview轮廓
            Layer skviewdimensioning = new Layer("skviewdimensioning");    //skview尺寸线层

            //参数
            double pi = Math.PI;
            string path = Convert.ToString(data["path"]);

            double scale = 3; //放大系数

            double h = 20;
            double b = 20;
            double dconms = 20;
            double l3 = 16.5;
            double wta = 15;
            double wf = 15;
            double oal = 127.03;
            double lf = 125;
            double s = 3;


            //坐标
            Vector2 v1 = new Vector2(0, 0);
            Vector2 v2 = new Vector2(v1.X + oal + 6, v1.Y);
            Vector2 v3 = new Vector2(v1.X + 3, v1.Y);
            Vector2 v4 = new Vector2(v3.X, v3.Y + dconms / 2);
            Vector2 v5 = new Vector2(v4.X + oal / 1.4, v4.Y);
            Vector2 v7 = new Vector2(v3.X + oal, v3.Y);
            Vector2 v6 = new Vector2(v7.X - l3, v7.Y);
            Vector2 v8 = new Vector2(v7.X, v7.Y - s);
            Vector2 v9 = new Vector2(v8.X - l3 / 9.163, v8.Y);
            Vector2 v10 = new Vector2(v9.X - 0.3, v3.Y - dconms / 3.782);
            Vector2 v11 = new Vector2(v10.X - oal / 35.41, v4.Y - dconms);
            Vector2 v12 = new Vector2(v4.X, v11.Y);
            Vector2 v13 = new Vector2(v9.X, v7.Y);
            Vector2 v14 = new Vector2(v7.X - l3 / 4.581, v7.Y);
            Vector2 v15 = new Vector2(v14.X, v9.Y);
            Vector2 v16 = new Vector2(v6.X + l3 / 9.163, v6.Y);
            Vector2 v17 = new Vector2(v16.X, v9.Y);
            Vector2 v18 = new Vector2(v6.X, v9.Y);
            Vector2 a1 = new Vector2(v7.X - oal / 2.233, v7.Y);
            Vector2 a2 = new Vector2(v7.X - l3 / 2, v7.Y);

            Vector2 v19 = new Vector2(v1.X, v1.Y - oal);
            Vector2 v20 = new Vector2(v19.X + oal + 6, v19.Y);
            Vector2 v21 = new Vector2(v19.X + 3, v19.Y);
            Vector2 v22 = new Vector2(v21.X, v21.Y + dconms / 2);
            Vector2 v23 = new Vector2(v11.X, v22.Y);
            Vector2 v24 = new Vector2(v9.X, v23.Y - dconms / 3.963);
            Vector2 v25 = new Vector2(v21.X + lf, v21.Y - wta);
            Vector2 v26 = fun.Polar(v25, 61 * pi / 180, l3 / 7.542);
            Vector2 v27 = fun.Polar(v26, 20 * pi / 180, l3 / 16.481);
            Vector2 v28 = fun.Polar(v27, 90 * pi / 180, l3 / 1.699);
            Vector2 v29 = fun.Polar(v28, 112 * pi / 180, l3 / 7.807);
            Vector2 v30 = fun.Polar(v29, 62 * pi / 180, l3 / 7.807);
            Vector2 v31 = fun.Polar(v30, 177 * pi / 180, l3 / 7.177);
            Vector2 v32 = fun.Polar(v31, 139 * pi / 180, l3 / 20.227);
            Vector2 v33 = fun.Polar(v31, -149 * pi / 180, l3 / 1.745);
            Vector2 v34 = fun.Polar(v33, -121 * pi / 180, l3 / 7.672);
            Vector2 v35 = fun.Polar(v34, -172 * pi / 180, l3 / 4.944);
            Vector2 v36 = fun.Polar(v35, -41 * pi / 180, l3 / 8.558);
            Vector2 v37 = fun.Polar(v36, -63 * pi / 180, l3 / 16.481);
            Vector2 v38 = fun.Polar(v37, -31 * pi / 180, l3 / 1.725);
            Vector2 v39 = fun.Polar(v25, 119 * pi / 180, l3 / 6.357);
            Vector2 v40 = new Vector2(v22.X, v22.Y - dconms);
            Vector2 v41 = new Vector2(v37.X + (v37.Y - v40.Y) / Math.Tan(31 * pi / 180), v40.Y);
            Vector2 v42 = fun.Polar(v41, 166 * pi / 180, lf / 4.789);
            Vector2 v43 = fun.Polar(v42, 92 * pi / 180, lf / 17.265);
            Vector2 v44 = new Vector2(v23.X - lf / 16.644, v23.Y);
            Vector2 v45 = new Vector2(v24.X, v30.Y + (v30.X - v24.X) * Math.Tan(3 * pi / 180));
            Vector2 v46 = new Vector2(v35.X + l3 / 1.567, v25.Y + l3 / 1.943);
            Vector2 a3 = new Vector2(v1.X, v20.Y);

            Vector2 v47 = new Vector2(v2.X + oal, v5.Y);
            Vector2 v48 = new Vector2(v47.X + oal, v47.Y);
            Vector2 v49 = new Vector2(v48.X, v48.Y - s);
            Vector2 v50 = new Vector2(v48.X - l3 / 9.163, v49.Y);
            Vector2 v51 = new Vector2(v50.X, v48.Y - h);
            Vector2 v52 = new Vector2(v47.X, v51.Y);
            Vector2 v53 = new Vector2(v48.X - l3, v48.Y);
            Vector2 v54 = new Vector2(v53.X, v50.Y);
            Vector2 v55 = new Vector2(v50.X, v48.Y);
            Vector2 v56 = new Vector2(v48.X - l3 / 4.581, v48.Y);
            Vector2 v57 = new Vector2(v56.X, v49.Y);
            Vector2 v58 = new Vector2(v53.X + l3 / 9.163, v53.Y);
            Vector2 v59 = new Vector2(v58.X, v49.Y);
            Vector2 v60 = new Vector2(v47.X + oal / 1.37, v47.Y);
            Vector2 v61 = new Vector2(v60.X, v51.Y);
            Vector2 a4 = new Vector2(v48.X - oal / 2.233, v48.Y);
            Vector2 a5 = new Vector2(v48.X - l3 / 2, v48.Y);

            Vector2 v62 = new Vector2(v47.X, v47.Y - oal);
            Vector2 v63 = new Vector2(v62.X + lf / 1.068, v62.Y);
            Vector2 v64 = new Vector2(v51.X, v63.Y - b / 4.14);
            Vector2 v65 = new Vector2(v62.X + oal, v63.Y - b / 2 - wta);
            Vector2 v66 = fun.Polar(v65, 61 * pi / 180, l3 / 7.542);
            Vector2 v67 = fun.Polar(v66, 20 * pi / 180, l3 / 16.481);
            Vector2 v68 = fun.Polar(v67, 90 * pi / 180, l3 / 1.699);
            Vector2 v69 = fun.Polar(v68, 112 * pi / 180, l3 / 7.807);
            Vector2 v70 = fun.Polar(v69, 62 * pi / 180, l3 / 7.807);
            Vector2 v71 = fun.Polar(v70, 177 * pi / 180, l3 / 7.177);
            Vector2 v72 = fun.Polar(v71, 139 * pi / 180, l3 / 20.227);
            Vector2 v73 = fun.Polar(v71, -149 * pi / 180, l3 / 1.745);
            Vector2 v74 = fun.Polar(v73, -121 * pi / 180, l3 / 7.672);
            Vector2 v75 = fun.Polar(v74, -172 * pi / 180, l3 / 4.944);
            Vector2 v76 = fun.Polar(v75, -41 * pi / 180, l3 / 8.558);
            Vector2 v77 = fun.Polar(v76, -63 * pi / 180, l3 / 16.481);
            Vector2 v78 = fun.Polar(v77, -31 * pi / 180, l3 / 1.725);
            Vector2 v79 = fun.Polar(v65, 119 * pi / 180, l3 / 6.357);
            Vector2 v80 = new Vector2(v62.X, v62.Y - b);
            Vector2 v83 = new Vector2(v61.X, v80.Y);
            Vector2 v84 = new Vector2(v83.X, v83.Y + b / 30.957);
            Vector2 v81=new Vector2 (v77.X +(v77.Y - v84.Y) / Math.Tan(31 * pi / 180), v84.Y);
            Vector2 v82 = new Vector2(v64 .X, v70.Y + (v70.X - v64.X) * Math.Tan(3 * pi / 180));
            Vector2 v85 = new Vector2(v75.X + l3 / 1.567, v65.Y + l3 / 1.943);
            Vector2 a6 = new Vector2(v4.X, v63.Y - b / 2);
            Vector2 a7 = new Vector2(v64.X, a6.Y);
            Vector2 a8 = new Vector2(v84.X, v63.Y);

            Vector2 v86 = new Vector2(v5.X, v20.Y - oal);
            Vector2 v87 = new Vector2(v86.X, v86.Y + oal / 2.604);
            Vector2 v88 = fun.Polar(v87, -166 * pi / 180, oal / 17.653);
            Vector2 v89 = fun.Polar(v88, -171 * pi / 180, oal / 18.622);
            Vector2 v90 = fun.Polar(v89, -165 * pi / 180, oal / 18.287);
            Vector2 v91 = fun.Polar(v90, -172 * pi / 180, oal / 14.825);
            Vector2 v92 = fun.Polar(v91, -161 * pi / 180, oal / 14.754);
            Vector2 v93 = fun.Polar(v86, 143 * pi / 180, oal / 2.139);
            Vector2 v94 = fun.Polar(v86, 143 * pi / 180, oal / 2.691);
            Vector2 v95 = new Vector2(v94.X + oal / 7.169, v94.Y);
            Vector2 v96 = fun.Polar(v95, 60 * pi / 180, oal / 31.485);
            Vector2 v97 = new Vector2(v96.X + oal / 24.432, v96.Y);
            Vector2 v98 = fun.Polar(v97, -68 * pi / 180, oal / 10.83);
            Vector2 v99 = fun.Polar(v98, -47 * pi / 180, oal / 64.979);
            Vector2 v100 = fun.Polar(v99, 39 * pi / 180, oal / 55.527);
            Vector2 v101 = new Vector2(v86.X, v100.Y + oal / 11.612);
            Vector2 v102 = new Vector2(v86.X + oal / 3.323, v99.Y + oal / 2.027);
            Vector2 v103 = new Vector2(v102.X, v102.Y - oal / 1.238);
            Vector2 v104 = new Vector2(v103.X - oal / 1.063, v103.Y);
            Vector2 v105 = new Vector2(v104.X, v102.Y);

            Vector2 a86 = new Vector2(v61.X, v63.Y -b / 2 - oal);
            Vector2 a87 = new Vector2(a86.X, a86.Y + oal / 2.604);
            Vector2 a88 = fun.Polar(a87, -166 * pi / 180, oal / 17.653);
            Vector2 a89 = fun.Polar(a88, -171 * pi / 180, oal / 18.622);
            Vector2 a90 = fun.Polar(a89, -165 * pi / 180, oal / 18.287);
            Vector2 a91 = fun.Polar(a90, -172 * pi / 180, oal / 14.825);
            Vector2 a92 = fun.Polar(a91, -161 * pi / 180, oal / 14.754);
            Vector2 a93 = fun.Polar(a86, 143 * pi / 180, oal / 2.139);
            Vector2 a94 = fun.Polar(a86, 143 * pi / 180, oal / 2.691);
            Vector2 a95 = new Vector2(a94.X + oal / 7.169, a94.Y);
            Vector2 a96 = fun.Polar(a95, 60 * pi / 180, oal / 31.485);
            Vector2 a97 = new Vector2(a96.X + oal / 24.432, a96.Y);
            Vector2 a98 = fun.Polar(a97, -68 * pi / 180, oal / 10.83);
            Vector2 a99 = fun.Polar(a98, -47 * pi / 180, oal / 64.979);
            Vector2 a100 = fun.Polar(a99, 39 * pi / 180, oal / 55.527);
            Vector2 a101 = new Vector2(a86.X, a100.Y + oal / 11.612);
            Vector2 a102 = new Vector2(a86.X + oal / 3.323, a99.Y + oal / 2.027);
            Vector2 a103 = new Vector2(a102.X, a102.Y - oal / 1.238);
            Vector2 a104 = new Vector2(a103.X - oal / 1.063, a103.Y);
            Vector2 a105 = new Vector2(a104.X, a102.Y);



            //作图
            Line line1 = new Line(v1, v2);
            line1.Layer = centre;
            line1.Linetype = Linetype.DashDot;
            line1.LinetypeScale = 3;
            dxf.AddEntity(line1);

            LwPolyline line2 = new LwPolyline();
            line2.Vertexes.Add(new LwPolylineVertex(v5));
            line2.Vertexes.Add(new LwPolylineVertex(v4));
            line2.Vertexes.Add(new LwPolylineVertex(v12));
            line2.Vertexes.Add(new LwPolylineVertex(v11));
            line2.Vertexes.Add(new LwPolylineVertex(v10));
            line2.Vertexes.Add(new LwPolylineVertex(v9));
            line2.Vertexes.Add(new LwPolylineVertex(v13));
            line2.Vertexes.Add(new LwPolylineVertex(v7));
            line2.Vertexes.Add(new LwPolylineVertex(v8));
            line2.Vertexes.Add(new LwPolylineVertex(v18));
            line2.Vertexes.Add(new LwPolylineVertex(v6));
            line2.Vertexes.Add(new LwPolylineVertex(v13));
            fun.PolyFill(dxf, line2, 0.5, contour);

            LwPolyline line3 = new LwPolyline();
            line3.Vertexes.Add(new LwPolylineVertex(v5));
            line3.Vertexes.Add(new LwPolylineVertex(v6));
            line3.Vertexes.Add(new LwPolylineVertex(v16));
            line3.Vertexes.Add(new LwPolylineVertex(v17));
            line3.Vertexes.Add(new LwPolylineVertex(v15));
            line3.Vertexes.Add(new LwPolylineVertex(v14));
            line3.Vertexes[0].Bulge = Math.Tan(67 * pi / 180 / 4);
            fun.PolyFill(dxf, line3, 0.5, contour);


            //2
            Line line4 = new Line(v19, v20);
            line4.Layer = centre;
            line4.Linetype = Linetype.DashDot;
            line4.LinetypeScale = 3;
            dxf.AddEntity(line4);

            LwPolyline line5 = new LwPolyline();
            line5.Vertexes.Add(new LwPolylineVertex(v44));
            line5.Vertexes.Add(new LwPolylineVertex(v43));
            line5.Vertexes.Add(new LwPolylineVertex(v42));
            line5.Vertexes.Add(new LwPolylineVertex(v41));
            line5.Vertexes.Add(new LwPolylineVertex(v40));
            line5.Vertexes.Add(new LwPolylineVertex(v22));
            line5.Vertexes.Add(new LwPolylineVertex(v23));
            line5.Vertexes.Add(new LwPolylineVertex(v24));
            line5.Vertexes.Add(new LwPolylineVertex(v45));
            line5.Vertexes[0].Bulge = Math.Tan(29 * pi / 180 / 4);
            line5.Vertexes[1].Bulge = Math.Tan(113 * pi / 180 / 4);
            line5.Vertexes[2].Bulge = Math.Tan(25 * pi / 180 / 4);
            fun.PolyFill(dxf, line5, 0.5, contour);

            LwPolyline line6 = new LwPolyline();
            line6.Vertexes.Add(new LwPolylineVertex(v25));
            line6.Vertexes.Add(new LwPolylineVertex(v26));
            line6.Vertexes.Add(new LwPolylineVertex(v27));
            line6.Vertexes.Add(new LwPolylineVertex(v28));
            line6.Vertexes.Add(new LwPolylineVertex(v29));
            line6.Vertexes.Add(new LwPolylineVertex(v30));
            line6.Vertexes.Add(new LwPolylineVertex(v31));
            line6.Vertexes.Add(new LwPolylineVertex(v32));
            line6.Vertexes.Add(new LwPolylineVertex(v33));
            line6.Vertexes.Add(new LwPolylineVertex(v34));
            line6.Vertexes.Add(new LwPolylineVertex(v35));
            line6.Vertexes.Add(new LwPolylineVertex(v36));
            line6.Vertexes.Add(new LwPolylineVertex(v37));
            line6.Vertexes.Add(new LwPolylineVertex(v38));
            line6.Vertexes.Add(new LwPolylineVertex(v39));
            line6.Vertexes.Add(new LwPolylineVertex(v25));
            fun.PolyFill(dxf, line6, 0.5, contour);

            fun.drawcircle(dxf, v46, l3 / 10.564, 0.5, contour);


            //3
            LwPolyline line8 = new LwPolyline();
            line8.Vertexes.Add(new LwPolylineVertex(v55));
            line8.Vertexes.Add(new LwPolylineVertex(v51));
            line8.Vertexes.Add(new LwPolylineVertex(v52));
            line8.Vertexes.Add(new LwPolylineVertex(v47));
            line8.Vertexes.Add(new LwPolylineVertex(v48));
            line8.Vertexes.Add(new LwPolylineVertex(v49));
            line8.Vertexes.Add(new LwPolylineVertex(v54));
            line8.Vertexes.Add(new LwPolylineVertex(v53));
            line8.Vertexes.Add(new LwPolylineVertex(v56));
            line8.Vertexes.Add(new LwPolylineVertex(v57));
            line8.Vertexes.Add(new LwPolylineVertex(v59));
            line8.Vertexes.Add(new LwPolylineVertex(v58));
            fun.PolyFill(dxf, line8, 0.5, contour);

            LwPolyline line9 = new LwPolyline();
            line9.Vertexes.Add(new LwPolylineVertex(v61));
            line9.Vertexes.Add(new LwPolylineVertex(v60));
            fun.PolyFill(dxf, line9, 0.5, contour);


            //4
            LwPolyline line10 = new LwPolyline();
            line10.Vertexes.Add(new LwPolylineVertex(v82));
            line10.Vertexes.Add(new LwPolylineVertex(v64));
            line10.Vertexes.Add(new LwPolylineVertex(v63));
            line10.Vertexes.Add(new LwPolylineVertex(v62));
            line10.Vertexes.Add(new LwPolylineVertex(v80));
            line10.Vertexes.Add(new LwPolylineVertex(v83));
            line10.Vertexes.Add(new LwPolylineVertex(v84));
            line10.Vertexes.Add(new LwPolylineVertex(v81));
            fun.PolyFill(dxf, line10, 0.5, contour);

            LwPolyline line11 = new LwPolyline();
            line11.Vertexes.Add(new LwPolylineVertex(v65));
            line11.Vertexes.Add(new LwPolylineVertex(v66));
            line11.Vertexes.Add(new LwPolylineVertex(v67));
            line11.Vertexes.Add(new LwPolylineVertex(v68));
            line11.Vertexes.Add(new LwPolylineVertex(v69));
            line11.Vertexes.Add(new LwPolylineVertex(v70));
            line11.Vertexes.Add(new LwPolylineVertex(v71));
            line11.Vertexes.Add(new LwPolylineVertex(v72));
            line11.Vertexes.Add(new LwPolylineVertex(v73));
            line11.Vertexes.Add(new LwPolylineVertex(v74));
            line11.Vertexes.Add(new LwPolylineVertex(v75));
            line11.Vertexes.Add(new LwPolylineVertex(v76));
            line11.Vertexes.Add(new LwPolylineVertex(v77));
            line11.Vertexes.Add(new LwPolylineVertex(v78));
            line11.Vertexes.Add(new LwPolylineVertex(v79));
            line11.Vertexes.Add(new LwPolylineVertex(v65));
            fun.PolyFill(dxf, line11, 0.5, contour);

            fun.drawcircle(dxf, v85, l3 / 10.564, 0.5, contour);

            //5
            LwPolyline line13 = new LwPolyline();
            line13.Vertexes.Add(new LwPolylineVertex(v87));
            line13.Vertexes.Add(new LwPolylineVertex(v88));
            line13.Vertexes.Add(new LwPolylineVertex(v89));
            line13.Vertexes.Add(new LwPolylineVertex(v90));
            line13.Vertexes.Add(new LwPolylineVertex(v91));
            line13.Vertexes.Add(new LwPolylineVertex(v92));
            line13.Vertexes.Add(new LwPolylineVertex(v93));
            line13.Vertexes.Add(new LwPolylineVertex(v86));
            line13.Vertexes.Add(new LwPolylineVertex(v87));
            line13.Vertexes[0].Bulge = Math.Tan(-93 * pi / 180 / 4);
            line13.Vertexes[1].Bulge = Math.Tan(81 * pi / 180 / 4);
            line13.Vertexes[2].Bulge = Math.Tan(-85 * pi / 180 / 4);
            line13.Vertexes[3].Bulge = Math.Tan(77 * pi / 180 / 4);
            line13.Vertexes[4].Bulge = Math.Tan(-64 * pi / 180 / 4);
            line13.Vertexes[5].Bulge = Math.Tan(66 * pi / 180 / 4);
            fun.PolyFill(dxf, line13, 0.5, contour);

            LwPolyline line14 = new LwPolyline();
            line14.Vertexes.Add(new LwPolylineVertex(v94));
            line14.Vertexes.Add(new LwPolylineVertex(v95));
            line14.Vertexes.Add(new LwPolylineVertex(v96));
            line14.Vertexes.Add(new LwPolylineVertex(v97));
            line14.Vertexes.Add(new LwPolylineVertex(v98));
            line14.Vertexes.Add(new LwPolylineVertex(v99));
            line14.Vertexes.Add(new LwPolylineVertex(v100));
            line14.Vertexes.Add(new LwPolylineVertex(v101));
            fun.PolyFill(dxf, line14, 0.5, contour);

            Line line15 = new Line(v102, v103);
            line15.Layer = refin;
            line15.Linetype = Linetype.Dashed;
            line15.LinetypeScale = 5;
            dxf.AddEntity(line15);

            Line line16 = new Line(v104, v103);
            line16.Layer = refin;
            line16.Linetype = Linetype.Dashed;
            line16.LinetypeScale = 5;
            dxf.AddEntity(line16);


            Line line17 = new Line(v102, v105);
            line17.Layer = refin;
            line17.Linetype = Linetype.Dashed;
            line17.LinetypeScale = 5;
            dxf.AddEntity(line17);


            Line line18 = new Line(v104, v105);
            line18.Layer = refin;
            line18.Linetype = Linetype.Dashed;
            line18.LinetypeScale = 5;
            dxf.AddEntity(line18);

            //6
            LwPolyline line19 = new LwPolyline();
            line19.Vertexes.Add(new LwPolylineVertex(a87));
            line19.Vertexes.Add(new LwPolylineVertex(a88));
            line19.Vertexes.Add(new LwPolylineVertex(a89));
            line19.Vertexes.Add(new LwPolylineVertex(a90));
            line19.Vertexes.Add(new LwPolylineVertex(a91));
            line19.Vertexes.Add(new LwPolylineVertex(a92));
            line19.Vertexes.Add(new LwPolylineVertex(a93));
            line19.Vertexes.Add(new LwPolylineVertex(a86));
            line19.Vertexes.Add(new LwPolylineVertex(a87));
            line19.Vertexes[0].Bulge = Math.Tan(-93 * pi / 180 / 4);
            line19.Vertexes[1].Bulge = Math.Tan(81 * pi / 180 / 4);
            line19.Vertexes[2].Bulge = Math.Tan(-85 * pi / 180 / 4);
            line19.Vertexes[3].Bulge = Math.Tan(77 * pi / 180 / 4);
            line19.Vertexes[4].Bulge = Math.Tan(-64 * pi / 180 / 4);
            line19.Vertexes[5].Bulge = Math.Tan(66 * pi / 180 / 4);
            fun.PolyFill(dxf, line19, 0.5, contour);

            LwPolyline line20 = new LwPolyline();
            line20.Vertexes.Add(new LwPolylineVertex(a94));
            line20.Vertexes.Add(new LwPolylineVertex(a95));
            line20.Vertexes.Add(new LwPolylineVertex(a96));
            line20.Vertexes.Add(new LwPolylineVertex(a97));
            line20.Vertexes.Add(new LwPolylineVertex(a98));
            line20.Vertexes.Add(new LwPolylineVertex(a99));
            line20.Vertexes.Add(new LwPolylineVertex(a100));
            line20.Vertexes.Add(new LwPolylineVertex(a101));
            fun.PolyFill(dxf, line20, 0.5, contour);

            Line line21 = new Line(a102, a103);
            line21.Layer = refin;
            line21.Linetype = Linetype.Dashed;
            line21.LinetypeScale = 5;
            dxf.AddEntity(line21);

            Line line22 = new Line(a104, a103);
            line22.Layer = refin;
            line22.Linetype = Linetype.Dashed;
            line22.LinetypeScale = 5;
            dxf.AddEntity(line22);


            Line line23 = new Line(a102, a105);
            line23.Layer = refin;
            line23.Linetype = Linetype.Dashed;
            line23.LinetypeScale = 5;
            dxf.AddEntity(line23);


            Line line24 = new Line(a104, a105);
            line24.Layer = refin;
            line24.Linetype = Linetype.Dashed;
            line24.LinetypeScale = 5;
            dxf.AddEntity(line24);



            //坐标系
            fun.Axis(dxf, v3, 90, 180, "Y", "Z", "", 1, 2, 0);

            fun.Axis(dxf, a1, 90, 180, "Y", "Z", "", 1, 2, 0);

            fun.Axis(dxf, a2, 90, 180, "Z", "Y", "", 1, 2, 0);

            fun.Axis(dxf, v21 , -90, 180, "X", "Z", "", 1, 2, 0);

            fun.Axis(dxf, a3, 90, 180, "X", "Y", "", 1, 2, 0);

            fun.Axis(dxf, v46, -90, 180, "X", "Y", "", 1, 2, 0);

            fun.Axis(dxf, v52, 90, 180, "Y", "Z", "", 1, 2, 0);

            fun.Axis(dxf, a4, 90, 180, "Y", "Z", "", 1, 2, 0);

            fun.Axis(dxf, a5, 90, 180, "Z", "Y", "", 1, 2, 0);

            fun.Axis(dxf, v62, -90, 180, "X", "Z", "", 1, 2, 0);

            fun.Axis(dxf, a6, 90, 180, "X", "Y", "", 1, 2, 0);

            fun.Axis(dxf, v85, -90, 180, "X", "Y", "", 1, 2, 0);




            //标注

            double height = 2;
            double arrowsize = 2;
            double exline = 2;



            //1
            fun.dimrot1(dxf, v1, v7, 0, oal / 3, 1, height, arrowsize, exline, "LPR", "", "");

            fun.dimrot1(dxf, v1, v13, 0, oal / 3 -l3, 1, height, arrowsize, exline, "LTA", "", "");

            //2
            fun.dimrot1(dxf, v21, v40, 90, l3 / 2, 1, height, arrowsize, exline, "DCONMS", "", "");

            fun.dimrot1(dxf, v40, v25, 180, l3, 1, height, arrowsize, exline, "LF", "", "");

            fun.dimrot1(dxf, v40, v26, 180, l3 * 2, 1, height, arrowsize, exline, "OAL", "", "");

            fun.dimrot1(dxf, v24, v20, -90, l3 / 2, 1, height, arrowsize, exline, "WF,WTA", "", "");

            fun.drawcircle(dxf, v25, l3 / 2.781, 0.5, dimensioning);

            //3
            fun.dimrot1(dxf, v47, v52, 90, l3 / 2, 1, height, arrowsize, exline, "H", "", "");

            fun.dimrot1(dxf, a4, v48, 0, oal / 3 - h / 2, 1, height, arrowsize, exline, "LPR", "", "");

            fun.dimrot1(dxf, a4, v55, 0, oal / 3 - l3, 1, height, arrowsize, exline, "LTA", "", "");

            fun.dimrot1(dxf, v51, v48, -90, l3 * 2, 1, height, arrowsize, exline, "HF", "", "");

            //4
            fun.dimrot1(dxf, v62, v80, 90, l3 / 2, 1, height, arrowsize, exline, "B", "", "");

            fun.dimrot1(dxf, v63, a7, 90, oal / 2, 1, height, arrowsize, exline, "=", "", "");

            fun.dimrot1(dxf, v83, a7, 90, oal / 2 - (v63.X + a7.X) / 2 + (v83.X + a7.X) / 2, 1, height, arrowsize, exline, "=", "", "");

            fun.dimrot1(dxf, v65, a7, -90, l3 * 2, 1, height, arrowsize, exline, "WTA", "", "");

            fun.dimrot1(dxf, v65, v63, -90, l3 * 3, 1, height, arrowsize, exline, "WF", "", "");

            fun.dimrot1(dxf, v80, v65, 180, l3, 1, height, arrowsize, exline, "LF", "", "");

            fun.dimrot1(dxf, v80, v67, 180, l3 * 2, 1, height, arrowsize, exline, "OAL", "", "");

            fun.drawcircle(dxf, v65, l3 / 2.781, 0.5, dimensioning);

            //6
            fun.dimrot1(dxf, v99, v86, 180, dconms, 1, height, arrowsize, exline, "PDX", "", "");

            fun.dimrot1(dxf, v99, v86, -90, dconms, 1, height, arrowsize, exline, "PDY", "", "");

            //7
            fun.dimrot1(dxf, a99, a86, 180, dconms, 1, height, arrowsize, exline, "PDX", "", "");

            fun.dimrot1(dxf, a99, a86, -90, dconms, 1, height, arrowsize, exline, "PDY", "", "");





            //定义格式，路径导出
            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
            dxf.Save(path);


        }

    }
}
